home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / Sample Code / Archive / Graphics / QuickDraw GX / GX->PostScript Sample / GXToPostScript / Internal Headers / ProcessShape.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-28  |  4.9 KB  |  208 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        ProcessShape.h
  3.  
  4.      Contains:    QuickDraw GX to PostScript conversion code.
  5.                  this file contains the definitions and data structures that are needed 
  6.                 to invoke the routines that deal with various shapes
  7.  
  8.      Version:    Technology:    Quickdraw GX 1.1.x
  9.       
  10.      Copyright:    © 1991-1997 by Apple Computer, Inc., all rights reserved.
  11. */
  12.  
  13.  
  14. #ifndef __PROCESSSHAPE__
  15. #define __PROCESSSHAPE__
  16.  
  17. #include <GXGraphics.h>
  18.  
  19. #define kStackListIncrement        8
  20.  
  21. typedef struct    {
  22.     
  23.     gxShape        sh;
  24.     
  25.     long        mark;
  26.     long        count;
  27.     
  28.     gxStyle        savestyle;
  29.     gxInk        saveink;
  30.     gxTransform    savetransform;
  31.     
  32. } TShapeNMark;
  33.  
  34. typedef struct    {
  35.  
  36.     gxTransform    **list;
  37.     
  38.     long    top;
  39.     long    mark;
  40.     long    count;
  41.     long    seed;
  42.     
  43.     gxShapeType    cliptype;
  44.  
  45. } TTransformList;
  46.  
  47.  
  48. typedef struct {
  49.     
  50.     TShapeNMark    **stack;        // this is the shape stack
  51.  
  52.     long        mark;
  53.     long        count;
  54.     
  55.     TTransformList    tr;            // this is the concatenated list of transform for this shape
  56.         
  57.     gxShape        sh;
  58.     long        index;
  59.  
  60.     gxStyle        savestyle;        // these fields are internal and are used for traversing the picture
  61.     gxInk        saveink;
  62.     gxTransform    savetransform;
  63.  
  64.     gxStyle        newstyle;
  65.     gxInk        newink;
  66.     gxTransform    newtransform;
  67.     
  68. } TShapeStack;
  69.  
  70. typedef struct    {
  71.     
  72.     gxRectangle    pagebounds;
  73.     gxPoint        pixelsize;
  74.     
  75. } TBBoxParam;
  76.  
  77.  
  78. typedef struct {
  79.  
  80.     gxShape        sh;                //         <-        the shape to draw
  81.     gxRectangle    shbbox;            //         <-        the bounds for this shape
  82.  
  83.     gxStyle        st;                //         <-        the overriding style to use
  84.     gxInk        tm;                //         <-        the overriding ink to use when drawing it
  85.     gxTransform    tr;                //         <-        the overriding transform to use
  86.     
  87.     TShapeStack    stack;            //          ->    the shape stack
  88.     TBBoxParam    bp;                //          ->    the page bounds
  89.         
  90. } TResolveParam;
  91.  
  92.  
  93. typedef struct    {
  94.     
  95.     gxShape    root;
  96.     gxShape    branch;
  97.     gxShape    node;
  98.     
  99.     short    seed;
  100.     
  101.     gxStyle        rootst;
  102.     gxInk        roottm;
  103.     gxTransform    roottr;
  104.  
  105. } TRNABlock;
  106.  
  107. typedef struct    {
  108.     
  109.     long    mark;                // what shape to get next 
  110.     long    count;                // up to what shape we should go till (same as index in TShapeStack)
  111.     
  112.     gxInk        tm;                    // the transfer mode to apply to all the shapes behind
  113.     gxShape        sh;                    // the shape that this block represents
  114.     gxRectangle    shbbox;                // the bounding rectangle of the clip
  115.  
  116. } TTModeBlock;
  117.  
  118. typedef struct    {
  119.  
  120.     TTModeBlock        **stack;
  121.     
  122.     long        mark;
  123.     long        count;
  124.  
  125. } TTModeStack;
  126.  
  127.  
  128. typedef struct    {
  129.  
  130.     gxShape        sh;
  131.     gxStyle        savestyle;
  132.     gxInk        saveink;
  133.     gxTransform    savetransform;
  134.     
  135. } TTMShapeOverrides;
  136.  
  137. typedef struct    {
  138.  
  139.     long    movedata[ sizeof( gxSetColor ) >> 2 ];
  140.     
  141. } TTMColorValues;
  142.  
  143.  
  144.  
  145. #define emptystackq( stackPtr )        ( (stackPtr)->mark == 0 )
  146. #define emptyrectangle( r ) ( ( ( (r)->right <= (r)->left ) || ( (r)->bottom <= (r)->top ) ) )
  147.  
  148. /* public routines */
  149.  
  150. void TMBoundsToPoints( gxPoint corners[], const gxRectangle *boundsPtr );
  151. void TMPointsToBounds( gxRectangle *boundsPtr, const gxPoint corners[] );
  152.  
  153. void TMGetShapeBounds( gxRectangle *boundsPtr, gxShape sh, TShapeStack *stackPtr, TBBoxParam * );
  154.  
  155.  
  156.  
  157. OSErr TMNewStack( TShapeStack * );
  158. void TMDisposeStack( TShapeStack * );
  159.  
  160. OSErr TMPushShape( TShapeStack *, gxShape );
  161. void TMPopShape( TShapeStack * );
  162. void TMRewindStack( TShapeStack * );
  163. void TMPeekShape( gxShape *, long *, long *, TShapeStack * );
  164.  
  165. gxShape TMGrabShape( TShapeStack * );
  166. void TMFixOverrides( gxShape, gxStyle, gxInk, gxTransform, TTMShapeOverrides * );
  167. void TMRestoreOverrides( TTMShapeOverrides * );
  168. gxShape TMNextShape( TShapeStack * );
  169. void TMSkipShape( TShapeStack * );
  170. void TMFreeShape( TShapeStack * );
  171.  
  172. OSErr TMConcatenateTransform( TTransformList *, gxTransform );
  173. OSErr TMInsertTMClip( TTransformList *, gxTransform );
  174. void TMRemoveTMClip( TTransformList * );
  175.  
  176. OSErr TMResolveShape( TResolveParam *, Boolean doresolve );
  177. void TMReleaseShape( TResolveParam * );
  178.  
  179. void TMAttachShape( TRNABlock *, gxShape , gxInk , TShapeStack * );
  180. void TMAttachShapeSimple( TRNABlock *, gxShape, TShapeStack * );
  181.  
  182. Boolean TMTestOrMode( gxInk );
  183. Boolean TMTestCopyMode( gxInk );
  184. Boolean TMTestComponentMode( gxTransferComponent *, unsigned char );
  185. short TMGetSpaceComponentCount( gxColorSpace );
  186. OSErr TMNewTModeStack( TTModeStack * );
  187. void TMDisposeTModeStack( TTModeStack * );
  188. OSErr TMPushTMBlock( TTModeStack *, gxShape, gxRectangle *, TShapeStack * );
  189. void TMPopTMBlock( TTModeStack *, TShapeStack * );
  190. void TMPeekTMBlock( long *, long *, gxRectangle *, TTModeStack * );
  191. void TMBumpTMBlock( TTModeStack *, TShapeStack * );
  192. void TMCombineColors( gxColor *, gxInk, TTModeStack * );
  193. Boolean TMTestIdentityMapping( gxMapping * );
  194. Boolean TMTestPerspectiveShape( gxShape );
  195. void TMFixTransferMode( gxInk );
  196. void TMFixComponent( gxTransferComponent *, gxColorValue );
  197. gxShape TMCombineBitmapColors( gxShape, gxInk, TTModeStack *, gxRectangle *, TTransformList *);
  198. gxShape TMGetBitmapPart( gxShape, gxRectangle *, TTransformList *, gxPoint *);
  199. Boolean TMGetDeviceMapping( gxMapping *, gxShape, TTransformList *);
  200. gxShape TMResolveBitmap( TShapeStack *, TTModeStack *, gxRectangle *);
  201. gxColor *TMMakeWhite( gxColor * );
  202.  
  203. typedef OSErr (*TMShapeProcPtr)(gxShape, long);
  204.  
  205. OSErr TMTraversePicture(gxShape, long, TMShapeProcPtr);
  206.  
  207. #endif
  208.